<template>
  <div class="fullscreen-button" @click="toggleFullscreen">
    <div class="button-container" :class="{ 'is-fullscreen': isFullscreen }">
      <div class="button-icon">
        <svg v-if="!isFullscreen" viewBox="0 0 24 24" width="20" height="20">
          <path fill="currentColor" d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/>
        </svg>
        <svg v-else viewBox="0 0 24 24" width="20" height="20">
          <path fill="currentColor" d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"/>
        </svg>
      </div>
      <div class="button-text">
        {{ isFullscreen ? '退出全屏' : '全屏显示' }}
      </div>
    </div>
    
    <!-- 装饰性边框 -->
    <div class="button-border">
      <div class="border-corner border-tl"></div>
      <div class="border-corner border-tr"></div>
      <div class="border-corner border-bl"></div>
      <div class="border-corner border-br"></div>
    </div>
  </div>
</template>

<script setup>
import { useFullscreen } from '../composables/useFullscreen'

// 使用全屏控制
const { isFullscreen, toggleFullscreen } = useFullscreen()
</script>

<style scoped>
.fullscreen-button {
  position: relative;
  display: inline-block;
  cursor: pointer;
  user-select: none;
}

.button-container {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(35, 95, 167, 0.1));
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 8px;
  color: #00d4ff;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 2;
}

.button-container:hover {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(35, 95, 167, 0.2));
  border-color: rgba(0, 212, 255, 0.6);
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
  transform: translateY(-2px);
}

.button-container.is-fullscreen {
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.1), rgba(255, 149, 0, 0.1));
  border-color: rgba(255, 107, 107, 0.3);
  color: #ff6b6b;
}

.button-container.is-fullscreen:hover {
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.2), rgba(255, 149, 0, 0.2));
  border-color: rgba(255, 107, 107, 0.6);
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.button-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.button-text {
  font-family: 'Microsoft YaHei', sans-serif;
  letter-spacing: 0.5px;
}

.button-border {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 1;
}

.border-corner {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  opacity: 0;
  transition: all 0.3s ease;
}

.border-tl {
  top: -2px;
  left: -2px;
  border-right: none;
  border-bottom: none;
}

.border-tr {
  top: -2px;
  right: -2px;
  border-left: none;
  border-bottom: none;
}

.border-bl {
  bottom: -2px;
  left: -2px;
  border-right: none;
  border-top: none;
}

.border-br {
  bottom: -2px;
  right: -2px;
  border-left: none;
  border-top: none;
}

.fullscreen-button:hover .border-corner {
  opacity: 1;
  animation: cornerPulse 1.5s ease-in-out infinite;
}

@keyframes cornerPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* 按钮点击效果 */
.fullscreen-button:active .button-container {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 212, 255, 0.2);
}

.fullscreen-button:active .button-container.is-fullscreen {
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.2);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .button-container {
    padding: 10px 16px;
    font-size: 12px;
  }
  
  .button-text {
    display: none;
  }
}
</style>
